package com.example.entity;

import java.io.Serializable;

public class Result<T> implements Serializable {
    private int code;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    private String msg;
    private T data;

    public Result(int i, String success, T o) {
        this.code = i;
        this.msg = success;
        this.data = o;
    }

    public static Result success() {
        return new Result(200, "success", null);
    }

    public static Result success(Object data) {
        return new Result(200, "success", data);
    }

    public static Result fail(String msg) {
        return new Result(500, msg, null);
    }

    // 构造方法、getter和setter省略
}

